home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 8.4 KB | 250 lines | [TEXT/MPS ] |
- {
- File: DeviceNotify.p
-
- Contains: xxx put contents here xxx
-
- Version: Technology: xxx put the technology version here xxx
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT DeviceNotify;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __DEVICENOTIFY__}
- {$SETC __DEVICENOTIFY__ := 1}
-
- {$I+}
- {$SETC DeviceNotifyIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
- {$IFC UNDEFINED __KERNEL__}
- {$I Kernel.p}
- {$ENDC}
- {$IFC UNDEFINED __NAMEREGISTRY__}
- {$I NameRegistry.p}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- {$IFC FOR_SYSTEM8_PREEMPTIVE }
- {
- §
- ##############################################################################
-
- File Name: DeviceNotifyPriv.h
-
- Description:
- The device notification service is used by Copland Kernel band
- Low level family expert code to inform high level "consumers" about
- hot plugging/un-plugging of devices.
-
- The High level families or code modules running in priviledged mode
- can subscribe to the service with the DevNRegisterInterestIn().
- LL Family notifies its consumers through the DevNNotifyThatThisChanged().
-
- ##############################################################################
- ############################
- Defines
- ############################
- }
-
- TYPE
- DevNRef = UInt32;
- {
- a connection Reference Num for a particular subscription
- a consumer subscription is identified by a unique
- DevNSubRef. In order to cancel a consumer registration,
- the DevNSubRef must be specified.
-
- a Reference Num for a particular notification
- A notification is identified by a unique DevNRef,
- since a notification can go through couple of states, and
- it needs to be tracked with a unique identifier.
-
- }
- {
- §
- ########################################################################
- Known & valid Service Category definitions are defined in DFM.h
- ########################################################################
- }
-
- CONST
- kDevNAllServiceCategories = $FFFFFFFF; { an option to subscribe to ALL valid service catagories }
-
- kMaxNumServiceCategories = 20; { ••• should be in DFM.h ••• }
-
- {
- §
- ########################################################################
- Event definition:
- If kDevNSoftRequestMask is set in conjunction with an event value,
- then a soft request is indicated, and the DevN will handle all the
- drudgery associated with two-way transactions, etc.
- (e.g. If (kDevNRemoved and kDevNSoftRequestMask) is received, it's
- a soft eject request)
- If kDevNSoftRequestMask is NOT set, then it's a hard request
- If the kDevNWarningMask is set, then it's an event warning that
- a given event is about to happen (and the consumer can't do a thing
- about it). It will be followed later on by a gone hard event.
- the kDevNWarningMask and the kDevNSoftRequestMask can NOT be set at
- the same time.
- ########################################################################
- }
-
- TYPE
- DevNEventType = UInt32;
- {
- pre-defined event mask
- §
- definition of valid global event
- (10/11/95) Events are now enum instead of masks
- enum for "unsigned" values
- }
-
- CONST
- kDevNSoftRequestMask = $80000000; { bit indicating soft request }
- kDevNWarningMask = $40000000; { bit indicating a warning request }
- kDevNAdded = 0; { New device/media/bus available }
- kDevNRemoved = 1; { Existing device/media/bus now gone }
- kDevNWakeup = 2; { Plug-in sw state no longer needs synchronization }
- kDevNSleep = 3; { Ask to synchronize SOFTWARE state of plug-in }
- { …used by PowerMgr, DriverReplacer, Soft Dev Eject }
- kDevNBootComplete = 4; { used by motherboard expert to inform DFM boot complete }
- kDevNIOInitComplete = 5; { I/O system initialize complete }
- kDevNNumOfPredefinedEvtInUse = 6;
- kDevNHighestEvtInUse = 5;
-
- { enum for "signed" values }
- kDevNSoftEject = $80000001; { (kDevNRemoved | kDevNSoftRequestMask) }
-
- {
- §
- ########################################################################
- Routine return value definition
- ########################################################################
- }
-
- TYPE
- DevNPermissionResponse = UInt32;
- { status returned by consumer to DevN }
-
- CONST
- kDevNPermissionGranted = 0; { consumer consented that instant removal of }
- { node is OK }
- kDevNPermissionDelayed = 1; { can not grant permission now, will inform producer through . }
- { DevN at a later time (ignored by the DevN if hard request) }
- kDevNPermissionDenied = 2; { do Not allow requested event to take place }
- { (ignored by the DevN if hard request) }
- kDevNValidPermissionMasks = 3;
-
- {
- ########################################################################
- Error code definition
- ########################################################################
- }
- kDevNMErrorCodeBase = 0;
- kInvalidSC = 1; { subscribe with invalid Service Category code }
- kInvalidEvent = 2; { subscribe with invalid event mask (zero) }
- kInvalidHandler = 3; { subscribe with NULL handler address }
- kNoSuchRef = 4; { Specified ID can not be found }
- kRecordNotFound = 5; { while unregistering, can not find record in array }
- kNotEnoughEventMask = 6; { not enough masks for DevNMCreateNewEvent call }
- kDeleteInvalidMasks = 7; { attempt to DevNMDeleteNewEvent on invalid event masks }
- kInvalidEventCount = 8; { invalid event count parameter being passed in }
- kInvalidPermission = 9; { bad permission returned from consumer }
- kTokenNotFound = 10; { sub record lookup list token not found }
-
- {
- ########################################################################
- Subroutine Prototype
- ########################################################################
- no more handlers
- ######################
- called by consumer
- ######################
- }
- FUNCTION DevNRegisterInterestIn(myFamily: OSType; eventCount: ItemCount; VAR events: DevNEventType; adminMessageObj: ObjectID; VAR thisRegistration: DevNRef; parm: UNIV Ptr): OSStatus; C;
- FUNCTION DevNUnregisterInterest(thisID: DevNRef): OSStatus; C;
- FUNCTION DevNMCreateNewEvent(VAR result: DevNEventType): OSStatus; C;
- {
- call to register family defined events.
- itemCount specifies how many events are desired
- (Only create one event at a time)
- }
- FUNCTION DevNMDeleteNewEvent(event: DevNEventType): OSStatus; C;
- { de-register the given event }
- FUNCTION DevNDelayedDownwardNotify(notifyRef: DevNRef; subscriptionRef: DevNRef; permission: DevNPermissionResponse): OSStatus; C;
- {
- must be called after an kDevNPermissionDelayed is returned to the DevN
- for a notification response.
- ######################
- called by producer
- ######################
- }
- FUNCTION DevNNotifyThatThisChanged(whichServiceCategory: OSType; whatHappened: DevNEventType; VAR whichDevice: RegEntryRef; adminMessageObj: ObjectID; VAR notRef: DevNRef; parm: UNIV Ptr): DevNPermissionResponse; C;
- FUNCTION DevNNotifyEvents(whatHappened: DevNEventType; VAR whichDevice: RegEntryRef; adminMessageObj: ObjectID; VAR notRef: DevNRef; parm: UNIV Ptr): DevNPermissionResponse; C;
- {
- #####################################
- Notification Message definitions
- #####################################
- }
-
- TYPE
- DevNMessagePtr = ^DevNMessage;
- DevNMessage = RECORD
- AdminMessageType: UInt32;
- subMessageType: UInt32;
- serviceCategory: OSType;
- event: DevNEventType;
- device: RegEntryRefPtr;
- parm: Ptr;
- notRef: DevNRef;
- returnPermission: DevNPermissionResponse;
- END;
-
- {
- #########################################################
- Device Notification sub-message types.
- (This is in the "subMessageType" field inside
- The DevNMessage structure)
- #########################################################
- }
-
- CONST
- kDevNNotifyMsg = $01;
- kDevNNotifyCancel = $02;
- kDevNNotifyDelayedReply = $03;
- kNextUnusedMsg = $04;
-
- {$ENDC}
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := DeviceNotifyIncludes}
-
- {$ENDC} {__DEVICENOTIFY__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-